﻿using System;
using System.Windows;
using System.Windows.Controls;

namespace Flare.Pages.Endpoint
{
    public partial class Delete : UserControl, ITypicalPage
    {
        public string name
        {
            get { return "Удаление"; }
        }

        int _id;

        public Delete(int ep_id)
        {
            _id = ep_id;
            InitializeComponent();
            var data = new Flare.DB.endpoints().Details(ep_id);
            headDelete.Text = string.Format("Подтвердите удаление сетевой точки {0} ", data.name);
        }

        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                new Flare.DB.endpoints().Delete(_id);
                deleteButton.ShowResult();
            }
            catch (Exception ex)
            {
                glob.kernel.ShowNotice(ex.Message);
            }
        }
    }
}
